import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '厂家名称',
    align:"center",
    dataIndex: 'factoryName'
   },
   {
    title: '厂家编码',
    align:"center",
    dataIndex: 'factoryCode'
   },
   {
    title: '厂家状态',
    align:"center",
    dataIndex: 'factoryStatus_dictText'
   },
   {
    title: '厂家联系人名称',
    align:"center",
    dataIndex: 'factoryUserName'
   },
   {
    title: '厂家联系人方式',
    align:"center",
    dataIndex: 'factoryPhone'
   },
   {
    title: '厂家地区',
    align:"center",
    dataIndex: 'factoryArea',
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
     {
      label: "厂家名称",
      field: "factoryName",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
     {
      label: "厂家编码",
      field: "factoryCode",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
	{
      label: "厂家状态",
      field: 'factoryStatus',
      component: 'JSelectMultiple',
      componentProps:{
          dictCode:"valid_status"
      },
      //colProps: {span: 6},
 	},
     {
      label: "厂家联系人名称",
      field: "factoryUserName",
      component: 'Input', //TODO 范围查询
      //colProps: {span: 6},
	},
	{
      label: "厂家地区",
      field: 'factoryArea',
      component: 'JAreaLinkage',
      componentProps: {
        saveCode: 'region',
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '厂家名称',
    field: 'factoryName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂家名称!'},
          ];
     },
  },
  {
    label: '厂家编码',
    field: 'factoryCode',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂家编码!'},
          ];
     },
  },
  {
    label: '厂家状态',
    field: 'factoryStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"valid_status"
     },
  },
  {
    label: '厂家联系人名称',
    field: 'factoryUserName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂家联系人名称!'},
          ];
     },
  },
  {
    label: '厂家联系人方式',
    field: 'factoryPhone',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂家联系人方式!'},
          ];
     },
  },
  {
    label: '厂家地区',
    field: 'factoryArea',
    component: 'JAreaLinkage',
    componentProps: {
      saveCode: 'region',
    },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入厂家地区!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  factoryName: {title: '厂家名称',order: 0,view: 'text', type: 'string',},
  factoryCode: {title: '厂家编码',order: 1,view: 'text', type: 'string',},
  factoryStatus: {title: '厂家状态',order: 2,view: 'list', type: 'string',dictCode: 'valid_status',},
  factoryUserName: {title: '厂家联系人名称',order: 3,view: 'text', type: 'string',},
  factoryPhone: {title: '厂家联系人方式',order: 4,view: 'text', type: 'string',},
  factoryArea: {title: '厂家地区',order: 5,view: 'pca', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}